<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="fck" %>
<%@page import="java.util.*,model.*,util.*,control.*,java.text.*"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display"%>
<!DOCTYPE html>
<html>
<head>
    <title>查看成绩</title>
    <meta charset="utf-8"/>
    <script  src='../../js/core.js'></script>
    <link type="text/css" rel='stylesheet' href="../../css/score.css"/>
</head>
<body>
          <%
           /*
           *验证权限
           *author 宋智洋
           *data 2011-11-26
           *update 胡瑾
           *data 2011-12-01
           *增加了userId
           */
			String flag = (String)session.getAttribute("flag");
			String userId = (String)session.getAttribute("userId");
			int studentId = Integer.parseInt(userId);
						
			if (flag != "student"|| flag==null )
			{
				%>
          <script language="javascript">
				     alert("您没有学生权限,请重新登录"); window.location.href="../../index.jsp";
				    </script>
          <%
				
			}else{
				Student student = new Student();
				StudentControl sc = new StudentControl();
				student = sc.GetStudent(studentId);
				//out.print("<p>"+student.getStudentName()+"   欢迎您</p>");
			}
			// 
           %>
<div id="page">
    <header class="header">
        <p class="title">胡瑾，欢迎你登录CAT测评系统</p>
        <p class="title">当前位置：首页&lt;&lt;查看成绩</p>
    </header>
 <form method="post">
 <table class='main'>
 <thead>
   <tr>
     <td>序号</td>
     <td>能力值</td>
     <td>题数</td>
     <td>考试开始时间</td>
     <td>总用时</td>
   </tr>
 </thead>
   <%
                        int k = 0;
                        request.setCharacterEncoding("utf-8");
                        int pages = ParamUtil.getInt(request,"pages",1);
                        int rowsPerPage = ParamUtil.getInt(request,"pageSize",10);
                        Answerlog answerlog = new Answerlog();
                        AnswerlogControl ac = new AnswerlogControl();		
                        Score score = new Score();
                        ScoreControl sc = new ScoreControl();
                        
                        List<Score>list = new ArrayList<Score>();
                        list = (List)sc.GetScore(pages,rowsPerPage);
                        request.setAttribute("test", list);
                        
                        
                        for(int i = 0; i<list.size();i++)
                        {
                            score = list.get(i);
                            k++;
                            System.out.println(score.getScoreId());
                            if(score.getStudentId() == studentId)
                            {
                            //四舍五入
                            double score_show = Math.floor((score.getScore() + 0.05d)*10)/10;
                            //double score_show = score.getScore();
                    %>
                    <tbody>
   <tr>
     <td><%=k %> </td>
     <td><%=score_show%></td>
     <td><%=score.getProblemNum()%></td>
     <td><%=score.getTestTime_start()%></td>
     <td><%=score.getTestTime()%></td>
   </tr>
   </tbody>
   <%
                            }//if
                        }//for 
                     %>
 </table>
	<center><%
		out.println(ScoreControl.pageInstance.getToolsMenu(pages));
	%></center>
	<p style='width:80%; margin:10px auto 170px;'><input type="button" onclick="javascript:window.history.go(-1)" class="btns fl br3" value="返   回"/></p>
  </form>
 <footer class="footer"><small>© 2012 Nenu</small></footer>
 </div>
</body>
</html>


